Project Settings -> CLOUD MESSAGING -> Server key
// https://console.firebase.google.com/u/0/project/iotnotification-c6ffe/settings/cloudmessaging/android:com.mygadgets2.iotalarm
// My server key for MyFirstFirebase project on Firebase
$server_key = "AAAAq05Z8aY:APA91bFb5XRAYaNAUG0RpsY18nrosAPozWuluTnvOMypTcu8_4uW0DsTES-pzmdNkrqAn4lhxDrc6P4K7n8bg22l1iPX3zCMmAZKyT3Cr724DgX4VHTKZmPrKc6_mABe19L4KTvqsJ3m";
// Do not need to use tokens anymore 2023/03/05
// Using subscription to topics instead
// unique token for mobile device
// change this for the mobile device you want to send message to
// get this from running the app on the mobile device
$token=
// galaxy phone
"enAlQXn1TM2NdKiXquGlWu:APA91bFdj4Z5tbOVIdGtXWvCcgb3I7MsQV45eUf9U-7ZRACWua9oaZqj8wKXXMC4P88VoyPBmru2ufi3c-RabmBozVQQhyX5Iett1A0i7Lj_XjVNu3CgmvOooGIPsuHIC9wk86ThfUul";
// tablet SM-T710
//"fN3K_hjoTmC4CschbTo4ja:APA91bGaDS799cl5LAfGzHkdtlcNCAP7hy1Xe8gOgkBUMsDvoZ52rS3wayBJVxVIG9XO3MDtkqqJDyJUPBm8scfv7OlOfkThg9y-KSQffkM_ihKtz5VR21vIXZtZ0YgGVXrMPMDJNSbU";
sendPushNotification($title, $message, $token, $server_key);
//////////////////////////////////////////////////////////
function sendPushNotification($title, $message, $token, $server_key) {
		
	echo "Sending\r\n
";
	echo " Title      = " . $title . "\r\n
";
	echo " Message    = " . $message . "\r\n
";
	echo " Token      = " . $token . "\r\n
";
	echo " Server key = " . $server_key . "\r\n
";
	//Firebase HTTP API URL
	$path_to_fcm = 'https://fcm.googleapis.com/fcm/send';
	
	$fields = array (
//		'to' => $token,				// send to one device with this token id
		'to' => '/topics/alarms',	// send to all subscribed to the topic "alarms"
//		'notification' => array ('title'=>$title,'body'=>$message),	// for sending notification payload
		'data' => array ('title'=>$title,'body'=>$message),			// for sending data payload
		'android_channel_id' => 'Alarm default channel',		// need to match in pushNotification method in MyFirebaseMessagingService.java file
		'priority' => 'high'
	);
	
	$headers = array (
		'Authorization:key=' . $server_key,
		'Content-Type:application/json'
	);
	$payload = json_encode($fields);
	$curl_session = curl_init(); 
	// need to install php-curl package if you do not see the following echo message
	echo "after curl init\r\n
"; 
	curl_setopt($curl_session, CURLOPT_URL, $path_to_fcm);
	curl_setopt($curl_session, CURLOPT_POST, true);
	curl_setopt($curl_session, CURLOPT_HTTPHEADER, $headers);
	curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($curl_session, CURLOPT_SSL_VERIFYHOST, 0);
	curl_setopt($curl_session, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($curl_session, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
	curl_setopt($curl_session, CURLOPT_POSTFIELDS, $payload);
	
	$result = curl_exec($curl_session);
	if ($result === FALSE) {
		die('FCM Send Error: ' . curl_error($curl_session));
	}
	curl_close($curl_session);
	echo "\r\n
 curl send successful \r\n
";
}	// end of function
?>